package demo.admin.controller;

import cn.hutool.json.JSONUtil;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import demo.admin.common.BaseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "role")
@Slf4j
@RestController
@RequestMapping("role")
public class ApiRoleController {

    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "角色列表接口——用于menu显示")
    @GetMapping("list")
    public BaseResult list() {
        String role = "[\n" +
                "  {\n" +
                "    path: '/example',\n" +
                "    component: '#',\n" +
                "    redirect: '/example/example-dialog',\n" +
                "    name: 'Example',\n" +
                "    meta: {\n" +
                "      title: 'router.example',\n" +
                "      icon: 'vi-ep:management',\n" +
                "      alwaysShow: true\n" +
                "    },\n" +
                "    children: [\n" +
                "      {\n" +
                "        path: 'example-dialog',\n" +
                "        component: 'views/Example/Dialog/ExampleDialog',\n" +
                "        name: 'ExampleDialog',\n" +
                "        meta: {\n" +
                "          title: 'router.exampleDialog'\n" +
                "        }\n" +
                "      },\n" +
                "      {\n" +
                "        path: 'example-add',\n" +
                "        component: 'views/Example/Page/ExampleAdd',\n" +
                "        name: 'ExampleAdd',\n" +
                "        meta: {\n" +
                "          title: 'router.exampleAdd',\n" +
                "          noTagsView: true,\n" +
                "          noCache: true,\n" +
                "          hidden: true,\n" +
                "          showMainRoute: true,\n" +
                "          activeMenu: '/example/example-page'\n" +
                "        }\n" +
                "      },\n" +
                "      {\n" +
                "        path: 'example-edit',\n" +
                "        component: 'views/Example/Page/ExampleEdit',\n" +
                "        name: 'ExampleEdit',\n" +
                "        meta: {\n" +
                "          title: 'router.exampleEdit',\n" +
                "          noTagsView: true,\n" +
                "          noCache: true,\n" +
                "          hidden: true,\n" +
                "          showMainRoute: true,\n" +
                "          activeMenu: '/example/example-page'\n" +
                "        }\n" +
                "      },\n" +
                "      {\n" +
                "        path: 'example-detail',\n" +
                "        component: 'views/Example/Page/ExampleDetail',\n" +
                "        name: 'ExampleDetail',\n" +
                "        meta: {\n" +
                "          title: 'router.exampleDetail',\n" +
                "          noTagsView: true,\n" +
                "          noCache: true,\n" +
                "          hidden: true,\n" +
                "          showMainRoute: true,\n" +
                "          activeMenu: '/example/example-page'\n" +
                "        }\n" +
                "      }\n" +
                "    ]\n" +
                "  }\n" +
                "]";
        return BaseResult.success(JSONUtil.parseArray(role));
    }
}
